package cn.tedu.controller;

import cn.tedu.pojo.Car;
import cn.tedu.service.CarService;
import cn.tedu.service.CarServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Amos
 * @date 2021/9/11
 */

@RestController
@RequestMapping("car")
@CrossOrigin // 放行JS请求 跨域的解决方案
public class CarController {
    // 想要调用service层的代码--通过di实现
    @Autowired
    private CarService carService; //面向接口编程

    @RequestMapping("get")
    public Object get() {
        return carService.get(); // 把结果返回给浏览器
    }
}
